import re

# a = 'jkdx9087p908'
a = 'jkdx9087'

# python的正则表达式里,默认是贪婪模式
# 在次数限定符正则表达式里,使用?可以将贪婪模式转换为非贪婪模式
# result = re.search(r'x(.+)(\d+)', a)
# result = re.search(r'x(.+?)(\d*)', a)
#result = re.search(r'x(.{,3}?)(\d*)', a)
result = re.search(r'x(.{,3})(\d*)', a)

print(result.group())
print(result.group(1))
print(result.group(2))
